using UnityEngine;

namespace Exploder.Demo
{
	internal class RobotScript : MonoBehaviour
	{
		public float radius = 4f;

		public float velocity = 1f;

		private float angle;

		private Vector3 center;

		private Vector3 lastPos;

		private void Start()
		{
			center = base.gameObject.transform.position;
		}

		private void Update()
		{
			GetComponent<Animation>().Play();
		}

		private void FixedUpdate()
		{
			Vector3 position = base.gameObject.transform.position;
			position.x = center.x + Mathf.Sin(angle) * radius;
			position.z = center.z + Mathf.Cos(angle) * radius;
			base.gameObject.transform.position = position;
			base.gameObject.transform.forward = position - lastPos;
			lastPos = position;
			angle += Time.deltaTime * velocity;
		}
	}
}
